package com.ponhu.ea2.goodsCenter.provider.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ponhu.ea2.entity.GoodsDataSyncTaskLog;
import com.ponhu.ea2.goodsCenter.provider.mapper.GoodsDataSyncTaskLogMapper;
import com.ponhu.ea2.goodsCenter.provider.service.GoodsDataSyncTaskLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 *
 * @author zhaokai
 */
@Service
public class GoodsDataSyncTaskLogServiceImpl extends ServiceImpl<GoodsDataSyncTaskLogMapper, GoodsDataSyncTaskLog> implements GoodsDataSyncTaskLogService {


    @Resource
    GoodsDataSyncTaskLogMapper goodsDataSyncTaskLogMapper;

    /**
     * 获取最后一次任务执行的数据
     * @return
     */
    @Override
    public GoodsDataSyncTaskLog getLastGoodsDataSyncTaskLog(Integer taskType) {
        return goodsDataSyncTaskLogMapper.getLastDataEditTime(taskType);
    }


    @Override
    public Date getLastDataEditTime(Integer taskType){
        GoodsDataSyncTaskLog dataSyncTaskLog = getLastGoodsDataSyncTaskLog(taskType);
        if(null != dataSyncTaskLog){
            return dataSyncTaskLog.getDataEditTime();
        }
        return null;
    }
}




